n = int(input())
visited = [False] * n
step = 0
index = 0
for _ in range(1000):
    index = (index + step) % n
    visited[index] = True
    step += 1

found = False
for i in range(n):
    if not visited[i]:
        print(i + 1)
        found = True
if not found:
    print(0)